package com.xiaoleng.tlgsku.service.Impl;

import com.xiaoleng.tlgsku.dao.AttributeValueImgMapper;
import com.xiaoleng.tlgsku.pojo.AttributeValueImg;
import com.xiaoleng.tlgsku.service.AttributeValueImgService;
import com.xiaoleng.tlgsku.tools.Record;
import com.xiaoleng.tlgsku.tools.Status;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AttributeValueImgServiceImpl implements AttributeValueImgService {

    @Autowired
    private AttributeValueImgMapper attributeValueImgMapper;

    @Override
    public Record findImgBykeyId(Integer attributeId) {
        Record record = new Record();
        try{
            List<AttributeValueImg> list = attributeValueImgMapper.findImgBykeyId(attributeId);
            if(list.size()!=0&&null!=list){
                record.setStatus(Status.SELECT_SUCCESS);
                record.setMsg("查询keyid对应图片成功！");
                record.setData(list);
            }else{
                record.setStatus(Status.SELECT_FALIED);
                record.setMsg("查询keyid对应图片失败！");
            }
        }catch (Exception e){
                record.setStatus(Status.SELECT_FALIED);
                record.setMsg("查询keyid对应图片异常！");
        }finally {
                return record;
        }
    }
}
